package main

import (
	"unsafe"
	"fmt"
)

/*
#include <stdio.h>
#include <stdlib.h>

void test(char *s) {
	printf("%s\n",s);
}

char* cstr() {
	return "abcde";
}
*/
import "C"

func main() {
	s := "Hello, World"

	cs := C.CString(s)
	defer C.free(unsafe.Pointer(cs))

	C.test(cs)
	
	cs = C.cstr()
	
	fmt.Println(C.GoString(cs))
	fmt.Println(C.GoStringN(cs,2))
	fmt.Println(C.GoBytes(unsafe.Pointer(cs),2))
}
